<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ include file="menu.jsp" %>

<div class="main-wrap">
    <div class="crumb-wrap">
        <div class="crumb-list"><i class="icon-font"></i><a href="#">首页</a><span class="crumb-step">&gt;</span><a class="crumb-name" href="user_management.jsp">图书管理</a><span class="crumb-step">&gt;</span><span>修改图书</span></div>
    </div>
    <div class="result-wrap">
        <div class="result-content">
            <form action="${pageContext.request.contextPath}/book/adminUpdateBook" method="post"  >
                <table class="insert-tab" width="100%">
                    <tbody>
                    <tr>
                        <th><i class="require-red">*</i>书籍编号:</th>
                        <td>
                            <input class="common-text required" id="bookid" name="bookid" size="50"  type="text" value="${book.bookid}">
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>书籍名称:</th>
                        <td>
                            <input class="common-text required" id="bookname" name="bookname" size="50"  type="text" value="${book.bookname}">
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>书籍作者:</th>
                        <td><input class="common-text" id="bookauthor" name="bookauthor" size="50"  type="text" value="${book.bookauthor}"></td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>书籍价格:</th>
                        <td><input class="common-text" id="bookprice" name="bookprice" size="50"  type="text" value="${book.bookprice}"></td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>书籍数量:</th>
                        <td><input class="common-text" id="bookcount" name="bookcount" size="50"  type="text" value="${book.bookcount}"></td>
                    </tr>
                    <tr>
                        <td>
                            <input class="btn btn-primary btn6 mr10" value="提交" type="submit"  >

                        </td>
                    </tr>
                    </tbody></table>
            </form>
        </div>
    </div>

</div>
<!--/main-->
</div>
</body>
<script>

    function add() {
        var bookname=document.getElementById("bookname");
        var bookauthor=document.getElementById("bookauthor");
        var bookprice=document.getElementById("bookprice");
        var bookcount=document.getElementById("bookcount");
        var bookid=${book.bookid};
        if(confirm("确认修改图书吗?")) {
            $.ajax({
                url: "${pageContext.request.contextPath}/book/adminUpdateBook",
                type: "POST",
                contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
                data: {
                    "bookid":bookid,
                    "bookname":bookname,
                    "bookauthor":bookauthor,
                    "bookprice":bookprice,
                    "bookcount":bookcount
                },
                success: function () {
                    alert("修改成功!");
                    window.location = "/book/adminfindAllBook";
                },
                error: function () {
                    alert("修改失败");
                    window.location = "/adminupdatebook";
                }
            })
        }
    }

</script>
</html>